# -*- coding: utf-8 -*-
'''
@author: olivia.dou
Created on: 2019/4/19 16:09
desc:
'''

import logging
from util.db_util import execute_query

def has_intersection_with_dict_knews_labels(label_list,dict_labels):
    """判断输入的标签是否与字典（nlp_dict_knews_label表）中的标签有交集，用于判断重要句子"""
    return len(set(label_list).intersection(set(dict_labels)))>0

def get_company_tags():
    """获取指定快讯的公司标签"""
    pass

def get_sentence_articles(sentence_ids):
    """根据句子id的列表获取对应文章id的列表"""
    #sentence_ids：list 句子id的列表
    sentence_ids_str = '(%d)'%sentence_ids[0] if len(sentence_ids)==1 else repr(tuple(sentence_ids))
    sql = "SELECT DISTINCT oid FROM nlp_knews_sentence_all WHERE id in %s"%(sentence_ids_str)
    logging.debug(sql)
    res = execute_query(sql)
    return [item[0] for item in res]


